package com.wmobile.utils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public abstract class BaseObject implements Serializable {
	private String NameSpace;

	public String getNameSpace() {
		return NameSpace;
	}

	public void setNameSpace(String nameSpace) {
		NameSpace = nameSpace;
	}

	public static List<Map<String, Object>> ToObjectList(List<?> objs,
			String[] colNames) {
		List<Map<String, Object>> results = new ArrayList<Map<String, Object>>();
		for (Object obj : objs) {
			HashMap<String, Object> item = new HashMap<String, Object>();
			for (String colName : colNames) {
				try {
					item.put(colName, obj.getClass().getField(colName).get(obj));
				} catch (Exception ex) {
					ex.printStackTrace();
				}
			}
			results.add(item);
		}

		return results;
	}
}
